<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<p></p>
<script>
var oP = document.getElementsByTagName("p")[0];
oP.innerHTML = getNowTime();  //为了页面刷新时展示时间
setInterval(function (){
	oP.innerHTML = getNowTime();  //函数名加括号得到的是返回值
},1000)
function getNowTime(){
	var myTime = new Date();
	return adZ(myTime.getHours())+":"+adZ(myTime.getMinutes()+":"+adZ(myTime.getSeconds()));
}
function adZ(iNum){
	return iNum<10 ? "0"+iNum : ""+iNum;
}
</script>
</body>
</html>
